package ualrcdg.shared.requests;

/**
 * Simple implementation of the "Update Progress Request" object. See CDG XML Specifications: Server Requests: Update Progress.
 */
public class UpdateProgressRequest extends CDGRequest
{
	public static final String requestTag = "update";
	
	public static final String dtdName = "gameOperations.dtd";
	
	public final String username;
	public final String password;
	public final String gameId;
	public final String completedTask;
	
	/**
	 * Primary constructor
	 *
	 * @param requestId the requestId of the UpdateProgressRequest object to be created
	 * @param username the username of the UpdateProgressRequest object to be created
	 * @param password the password of the UpdateProgressRequest object to be created
	 * @param gameId the gameId of the UpdateProgressRequest object to be created
	 * @param completedTask the completedTask of the UpdateProgressRequest object to be created
	 */
	public UpdateProgressRequest( String requestId, String username, String password, String gameId, String completedTask )
	{
		super( requestId );
		
		if( username == null || password == null || gameId == null || completedTask == null )
		{
			throw new NullPointerException( "UpdateProgressRequest: unable to create request. Null parameters not allowed." );
		}
		
		this.username = username;
		this.password = password;
		this.gameId = gameId;
		this.completedTask = completedTask;
	}

	/*
	 * @see ualrcdg.shared.requests.CDGRequest#toString()
	 */
	@Override
	public String toString( )
	{
		return "UpdateProgressRequest [<" + super.toString( ) + "> username=" + username + ", password=" + password + ", gameId=" + gameId + ", completedTask=" + completedTask + "]";
	}
}
